From ee0a177847e4c4cfed0ba02458ab07cd86e40775 Mon Sep 17 00:00:00 2001 From: "rn@wyvis.research.intel-research.net" Date: Sun, 16 Mar 2003 12:02:49 +0000 Subject: [PATCH] bitkeeper revision 1.136.2.1 (3e7467e94A_D2ld8HeK-7FkHLGPCjg) minor tweak to schedule() --- xen/common/schedule.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 3ef29e3c5c..5a9a6c9611 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -249,11 +249,16 @@ asmlinkage void schedule(void) need_resched_back: perfc_incrc(sched_run2); - now = NOW(); - next = NULL; + prev = current; + next = NULL; + this_cpu = prev->processor; + spin_lock_irq(&schedule_data[this_cpu].lock); + + now = NOW(); + /* remove timer */ rem_ac_timer(&schedule_data[this_cpu].s_timer); @@ -261,11 +266,10 @@ asmlinkage void schedule(void) * deschedule the current domain */ - spin_lock_irq(&schedule_data[this_cpu].lock); - ASSERT(!in_interrupt()); ASSERT(__task_on_runqueue(prev)); + if (is_idle_task(prev)) goto deschedule_done; @@ -363,14 +367,14 @@ asmlinkage void schedule(void) * work out how long 'next' can run till its evt is greater than * 'next_prime's evt. Taking context switch allowance into account. */ - ASSERT(next_prime->evt > next->evt); + ASSERT(next_prime->evt >= next->evt); r_time = ((next_prime->evt - next->evt)/next->mcu_advance) + ctx_allow; sched_done: ASSERT(r_time != 0); - ASSERT(r_time > ctx_allow); + ASSERT(r_time >= ctx_allow); -#if 0 +#ifndef NDEBUG if ( (r_time==0) || (r_time < ctx_allow)) { printk("[%02d]: %lx\n", this_cpu, r_time); dump_rqueue(&schedule_data[this_cpu].runqueue, "foo"); @@ -389,7 +393,8 @@ asmlinkage void schedule(void) timer_redo: schedule_data[this_cpu].s_timer.expires = now + r_time; if (add_ac_timer(&schedule_data[this_cpu].s_timer) == 1) { - printk("SCHED[%02d]: Shit this shouldn't happen\n", this_cpu); + printk("SCHED[%02d]: Shit this shouldn't happen r_time=%lu\n", + this_cpu, r_time); now = NOW(); goto timer_redo; } -- 2.30.2